package com.lifa.controller;


import com.lifa.dao.NeitiaoDao;
import com.lifa.entity.Neitiao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/neitiao")
@Scope("prototype")
public class NeitiaoController {
    @Autowired
    private NeitiaoDao neitiaoDao;
    @RequestMapping("/selectNeitiao1")
    @ResponseBody
    public List<Neitiao> selectNeitiao1(){
        return neitiaoDao.selectneitiao();
    }

    @RequestMapping("/neitiaofenye1")
    @ResponseBody
    public Map<String,Object> neitiaofenye1(String username,int offset,int limit ){
        Map<String,Object> map=new HashMap<>();
        map.put("rows",neitiaoDao.neitiaofenye(username,offset,limit));
        map.put("total",neitiaoDao.neitiaozongtiaoshu(username));
        return map;
    }
}
